<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:spring="http://www.springframework.org/tags" version="2.0">
	<jsp:directive.page contentType="text/html; charset=UTF-8"
		pageEncoding="UTF-8" session="true" />
	<jsp:output doctype-root-element="html"
		doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
		omit-xml-declaration="true" />
	<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><spring:message code="customerpage.title" /></title>
<spring:url value="/resources/style.css" var="cssRes" />
<link href="${cssRes}" rel="stylesheet" type="text/css" />
</head>
<body>
	<c:import url="customerView/header.jsp" />

	<c:if test="${not empty message}">
		<spring:message code="${message}" />
	</c:if>
	<br />
	<br />

	<c:choose>
		<c:when test="${empty bookingItemList}">
			<spring:message code="page.customer.noItems" />
		</c:when>
		<c:otherwise>
			<div>
				<table id="booking">
					<THEAD>
						<tr id="booking">
							<TD class="center" id="booking"><spring:message
									code="customerpage.booking.date" /></TD>
							<TD class="center" id="booking"><spring:message
									code="customerpage.booking.carModel" /></TD>
							<td id="booking" class="center"><spring:message
									code="customerpage.booking.issuePlace" /></td>
							<td id="booking" class="center"><spring:message
									code="customerpage.booking.issueDate" /></td>
							<td id="booking" class="center"><spring:message
									code="customerpage.booking.amount" /></td>
							<td id="booking" class="center"><spring:message
									code="customerpage.booking.insurance" /></td>
							<td id="booking" class="center"><spring:message
									code="customerpage.booking.status" /></td>
						</tr>
					</THEAD>
					<TBODY>
						<c:forEach items="${bookingItemList}" var="bItem">
							<c:url var="payUrl" value="/customer/pay/${bItem.bookingId}" />
							<c:url var="showPaymantUrl"
								value="/customer/show/paymant/${bItem.paymant.paymantId}" />
							<c:url var="showInsuranceUrl"
								value="/customer/show/insurance/${bItem.insurance.insuranceId}" />

							<TR id="booking">
								<td id="booking"><c:out value="${bItem.date}" /></td>
								<td id="booking"><c:out value="${bItem.car.model}" /></td>
								<td id="booking"><c:out value="${bItem.placeOfIssue}" /></td>
								<td id="booking"><c:out value="${bItem.dateOfIssue}" /></td>
								<td id="booking"><c:choose>
										<c:when test="${bItem.paymant ne null}">
											<a href="${showPaymantUrl}"> <c:out
													value="${bItem.paymant.paid}" />
											</a>
										</c:when>
										<c:otherwise>
											<a href="${payUrl}"><spring:message
													code="customerpage.booking.pay" /></a>
										</c:otherwise>
									</c:choose></td>
								<td id="booking"><a href="${showInsuranceUrl}"><c:out
											value="${bItem.insurance.name}" /></a></td>
								<td id="booking"><c:out value="${bItem.status}" /></td>
							</TR>
						</c:forEach>
					</TBODY>
				</table>
			</div>
		</c:otherwise>
	</c:choose>
</body>
	</html>
</jsp:root>
